package com.jbm.jbmsupplier.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.jbm.jbmsupplier.R;

import java.util.ArrayList;

/**
 * Created by JBMhaier on 2017/8/3.
 */

/**
 * 报修分类的适配器
 */
public class FixCategoryGVAdapter extends BaseAdapter {

    private ArrayList<Integer> arr;
    public FixCategoryGVAdapter(Context c) {
        super(c);
        arr=new ArrayList();
        arr.add(R.mipmap.dsy_dianlufix);
        arr.add(R.mipmap.dsy_shuiluweixiu);
        arr.add(R.mipmap.dsy_qiangmianweixiu);
        arr.add(R.mipmap.dsy_guandaoshutong);
        arr.add(R.mipmap.dsy_weiyuweixiu);
        arr.add(R.mipmap.dsy_jiajuweixiu);
        arr.add(R.mipmap.dsy_jiadianweixiu);
        arr.add(R.mipmap.dsy_jiajuanquan);

    }

    @Override
    protected Object getHolder(View convertView) {
        return new MyCategoryHolder(convertView);
    }

    @Override
    protected int getLayout() {
        return R.layout.fixcategory_item;
    }

    @Override
    protected Object getArr() {
        return arr;
    }

    @Override
    protected void initView(Object holder, int position) {
        ((MyCategoryHolder) holder).img.setImageResource(arr.get(position));

    }

    @Override
    protected void initListener(Object holder, int position) {

    }

    class MyCategoryHolder {
        private final ImageView img;
        public MyCategoryHolder(View convertView){
            img=(ImageView)convertView.findViewById(R.id.category_item_img);
        }

    }

}
